import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  //任务
  {
    path: '/task',
    name: 'task',
    component: () => import('@/views/task'),
    meta: {
      title: '任务'
    }
  },
  {
    path: '/taskList',
    name: 'taskList',
    component: () => import('@/views/task/taskList'),
    meta: {
      title: '今日任务'
    }
  },
  {
    path: '/taskListDetails',
    name: 'taskListDetails',
    component: () => import('@/views/task/taskListDetails'),
    meta: {
      title: '任务详情页'
    }
  },
  {
    path: '/package',
    name: 'package',
    component: () => import('@/views/task/package'),
    meta: {
      title: '加速包'
    }
  },
  //集市
  {
    path: '/market',
    name: 'market',
    redirect: '/market/goods',
    component: () => import('@/views/blankLayout'),
    meta: {
      title: '新手攻略'
    },
    children: [
      {
        path: 'goods',
        name: 'goods',
        component: () => import('@/views/goods'),
        meta: {
          title: '集市',
          keepAlive: true
        }
      },
      {
        path: 'details',
        name: 'goodsDetails',
        component: () => import('@/views/goods/details'),
        meta: {
          title: '商品详情',
          keepAlive: false
        }
      },
    ]
  },


  //商品发布
  {
    path: '/goodsRelease',
    name: 'goodsRelease',
    component: () => import('@/views/goodsRelease'),
    meta: {
      title: '商品发布'
    }
  },
  //实名认证
  {
    path: '/authentication',
    name: 'authentication',
    component: () => import('@/views/authentication'),
    meta: {
      title: '实名认证'
    }
  },
  //收货地址管理
  {
    path: '/address',
    name: 'address',
    component: () => import('@/views/address'),
    meta: {
      title: '收货地址管理'
    }
  },
  //我的集市
  {
    path: '/myMarket',
    name: 'myMarket',
    component: () => import('@/views/myMarket'),
    meta: {
      title: '我的集市'
    }
  },
  //商品管理
  {
    path: '/goodsManagement',
    name: 'goodsManagement',
    component: () => import('@/views/goodsManagement'),
    meta: {
      title: '商品管理'
    }
  },
  //交易订单
  {
    path: '/orderManagement',
    name: 'orderManagement',
    redirect: '/orderManagement/index',
    component: () => import('@/views/slideLeftLayout'),
    children: [
      {
        path: 'index',
        name: 'orderManagementList',
        component: () => import('@/views/orderManagement'),
        meta: { title: '交易订单', index: 1, keepAlive: true }
      },
      {
        path: 'details',
        name: 'orderManagementDetails',
        component: () => import('@/views/orderManagement/details'),
        meta: { title: '订单详情', index: 2, keepAlive: false }
      }
    ]
  },

  //我的订单管理
  {
    path: '/myOrderManagement',
    name: 'myOrderManagement',
    redirect: '/myOrderManagement/index',
    component: () => import('@/views/slideLeftLayout'),
    children: [
      {
        path: 'index',
        name: 'myOrderManagementList',
        component: () => import('@/views/myOrderManagement'),
        meta: { title: '我的订单', index: 1, keepAlive: true }
      },
      {
        path: 'details',
        name: 'myOrderManagementDetails',
        component: () => import('@/views/myOrderManagement/details'),
        meta: { title: '订单详情', index: 2, keepAlive: false }
      },
      {
        path: 'afterSales',
        name: 'myOrderAfterSales',
        component: () => import('@/views/myOrderManagement/afterSales'),
        meta: {
          title: '申请售后', index: 3, keepAlive: false
        }
      }, 
    ]
  },
  {
    path: '/myOrder-afterSales',
    name: 'myOrder-afterSales',
    component: () => import('@/views/myOrderManagement/afterSales'),
    meta: {
      title: '申请售后'
    }
  }, 
  //城市盟主
  {
    path: '/cityLeader',
    name: 'cityLeader',
    component: () => import('@/views/cityLeader'),
    meta: {
      title: '城市盟主'
    }
  },
  {
    path: '/IncomeDetails',
    name: 'IncomeDetails',
    component: () => import('@/views/cityLeader/IncomeDetails'),
    meta: {
      title: '收益明细'
    }
  },
  //我的资产
  {
    path: '/myActivity',
    name: 'myActivity',
    component: () => import('@/views/myAssets/myActivity'),
    meta: {
      title: '活跃度'
    }
  },
  {
    path: '/myContribution',
    name: 'myContribution',
    component: () => import('@/views/myAssets/myContribution'),
    meta: {
      title: '贡献值'
    }
  },
  {
    path: '/myAmount',
    name: 'myAmount',
    component: () => import('@/views/myAssets/myAmount'),
    meta: {
      title: '我的元宝'
    }
  },
  {
    path: '/myGoldenBean',
    name: 'myGoldenBean',
    component: () => import('@/views/myAssets/myGoldenBean'),
    meta: {
      title: '我的金豆'
    }
  },
  {
    path: '/myRecommend',
    name: 'myRecommend',
    component: () => import('@/views/myAssets/myRecommend'),
    meta: {
      title: '推荐收益'
    }
  },
  {
    path: '/shelvesSetMeal',
    name: 'shelvesSetMeal',
    component: () => import('@/views/myAssets/shelvesSetMeal'),
    meta: {
      title: '上架套餐'
    }
  },
  //排行榜
  {
    path: '/rankingList',
    name: 'rankingList',
    component: () => import('@/views/rankingList'),
    meta: {
      title: '排行榜'
    }
  },
  //我的邀请
  {
    path: '/myInvitation',
    name: 'myInvitation',
    component: () => import('@/views/myInvitation'),
    meta: {
      title: '我的邀请'
    }
  },
  // 新手攻略
  {
    path: '/noviceStrategy',
    name: 'noviceStrategy',
    redirect: '/noviceStrategy/index',
    component: () => import('@/views/slideLeftLayout'),
    meta: {
      title: '新手攻略'
    },
    children: [
      {
        path: 'index',
        name: 'noviceStrategyList',
        component: () => import('@/views/noviceStrategy'),
        meta: { title: '新手攻略', index: 1, keepAlive: true }
      }, {
        path: 'details',
        name: 'noviceStrategyDetails',
        component: () => import('@/views/noviceStrategy/details'),
        meta: { title: '新手攻略', index: 2, keepAlive: false },
      }
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
